package com.base.config;

import com.base.common.RedisCache;
import com.base.filter.SystemFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author gxd
 * @since 2025/6/7
 */
@Configuration
public class FilterConfig {

    @Bean
    public FilterRegistrationBean<SystemFilter> filterRegistrationBean(RedisCache redisCache) {
        FilterRegistrationBean<SystemFilter> registrationBean = new FilterRegistrationBean<>();
        registrationBean.setFilter(new SystemFilter(redisCache));
        registrationBean.addUrlPatterns("/*");
        registrationBean.setOrder(1);
        return registrationBean;
    }
}
